package org.budo.dubbo.protocol.http.exception.consumer;

import java.lang.management.ManagementFactory;

import org.budo.support.java.net.util.JavaNetUtil;
import org.budo.support.lang.util.StringUtil;

import lombok.Getter;
import lombok.Setter;

/**
 * @author lmw
 */
@Getter
@Setter
public class AppSecretRequiredException extends ConsumerSideRuntimeException {
    private static final long serialVersionUID = -3949954505414028982L;

    private String appKey;

    public AppSecretRequiredException() {}

    public AppSecretRequiredException(String appKey) {
        this.appKey = appKey;
    }

    @Override
    public String getMessage() {
        return "#32 appSecret required for " + this.getAppKey() //
                + ", processName=" + ManagementFactory.getRuntimeMXBean().getName() //
                + ", ips=" + StringUtil.join(JavaNetUtil.getIpAddresses()) //
                + ", java.home=" + System.getProperty("java.home") //
                + ", java.io.tmpdir=" + System.getProperty("java.io.tmpdir");
    }
}